import Vue from 'vue'
import App from '@/App.vue'
import router from "@/routers"
import store from "@/store/index"

import NevType from "@/components/NevType"
import Slideshow from '@/components/Slideshow'
import Pagination from '@/components/Pagination'


//全局引入api
import * as api from "@/api"


import "@/mock/ServerMock"

import  loading from  "@/assets/loading.gif"
import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload, {
  preLoad: 1.3,
  loading: loading,
  attempt: 1
})

import {
  MessageBox,
  Message,
  Button,
  Input
} from 'element-ui';
//element-ui
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(Button)
Vue.use(Input)

Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$message = Message;

//全局引入api
Vue.prototype.$api = api

Vue.config.productionTip = false

Vue.component("NevType", NevType)
Vue.component("Slideshow", Slideshow)
Vue.component("Pagination", Pagination)



import VeeValidate from 'vee-validate'
import zh_CN from 'vee-validate/dist/locale/zh_CN'
Vue.use(VeeValidate)

VeeValidate.Validator.localize('zh_CN', {
  messages: {
    ...zh_CN.messages,
    is: (field) => `${field}必须与密码相同` // 修改内置规则的message
  },
  attributes: { // 给校验的field属性名映射中文名称
    phone: '手机号',
    code: '验证码',
    password: "密码",
    password2: "确认的密码",
    isChecked: "协议"
  }
})

VeeValidate.Validator.extend('agree', {
  validate: value => {
    return value
  },
  getMessage: field => field + '必须同意'
})



new Vue({
  beforeMount() {
    Vue.prototype.$bus = this;
  },
  render: h => h(App),
  router,
  store
}).$mount('#app')